<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 4.01 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page language="java" pageEncoding="UTF-8"%>
<%@ include file="/pages/safeai/jsp/common/taglibs.jsp"%>
<html>
<head>
<title>前台管理--活动管理</title>
<script type="text/javascript" src="${ctx}/script/common/common.js"></script>
<script type="text/javascript" src="${ctx}/js/Ajax.js"></script>
<%@ include file="/pages/safeai/jsp/common/meta.jsp"%>
<link href="${ctx}/css/safeai/together.css" rel="stylesheet" type="text/css">
</head>
<body>
<form action="${ctx}/others/activityManage.do?method=list" method="post">
<input type="hidden" name="method" value="list" />
<table width="100%" align="center">
	<TR>
		<TH class="td_01" height="25px">标题</TH>
		<TH class="td_01">简介</TH>
		<TH class="td_01">内容</TH>
		<TH class="td_01">链接地址</TH>
		<TH class="td_01">顺序</TH>
		<TH class="td_01">发布日期</TH>
		<TH class="td_01">发布作者</TH>
		<TH class="td_01">操作</TH>
	</TR>
	<logic:present name="ActivityRange">
		<logic:iterate id="activity" name="ActivityRange" property="records">
			<tr>
				<td class="td_03" width="120px">${activity.TITLE}</td>
				<td class="td_03" width="150px">${activity.SUMMARYINFO}</td>
				<td class="td_03" width="250px">${activity.CONTENT}</td>
				<td class="td_03" width="150px">${activity.URL}</td>
				<td class="td_03"><input type="text" style="width:20px" value="${activity.SEQUENCE}" id="${activity.ID}" onchange="javascript:editNum('${activity.ID}')"></td>
				<td class="td_03"><bean:write name="activity" property="publishDate" format="yyyy-MM-dd" /></td>
				<td class="td_03">${activity.PUBLISHUSER}</td>
				<td class="td_03"><a
					href="${ctx}/others/activityManage.do?method=edit&activity.id=${activity.ID}">修改</a>
				&nbsp;&nbsp;&nbsp;&nbsp; <a href="#"
					onmousedown="if(confirm('是否删除？')==true) location.href='${ctx}/others/activityManage.do?method=delete&activity.id=${activity.ID}'">删除</a></td>
			</tr>
		</logic:iterate>
	</logic:present>
	<tr>
		<td colspan="8" align="right">
		<div style="float:left">
			&nbsp;&nbsp;&nbsp;&nbsp;
			<a href="${ctx}/others/activityManage.do?method=add">添&nbsp;&nbsp;加</a>
		</div>
			<%@ include file="/pages/safeai/jsp/common/page.jsp"%>&nbsp;&nbsp;&nbsp;&nbsp;
		</td>
	</tr>
</table>
</form>
<input type="hidden" value="${ctx}" id="ctx">
</body>
<script type="text/javascript">
  //更新顺序到数据库 id是表的主键和text的id值
  function editNum(id){
    var ctx=document.getElementById("ctx");
    //获得要修改顺序的控件
    var text=document.getElementById(id);
    //验证
    testisNum(text);
    var ajax=new Ajax();
    ajax.ajaxRequest(ctx.value+"/others/activityManage.do","method=updateNumber&id="+id+"&number="+text.value,"GET",backEditNum);
  }
  function backEditNum(){
    //修改成功
  }
  function testisNum(object){
      var s =document.getElementById(object.id).value;
          if(s!=""){
             if(isNaN(s)){
                 alert("请输入数字");
                 object.value="";
                 object.focus();
                 return;
             }
          }else{
                 alert("此处不能为空！若为空则不做修改！");
                 object.focus();
                 return;
          }
   }
</script>
</html>